fitfile=$1
gethead $fitfile 'RA' >ralog
if test -s ralog 
then
	ra=`gethead $fitfile 'objra'`
	dec=`gethead $fitfile 'objdec'`
 	solve-field --use-source-extractor --nsigma 5 -O -t 4 -H 1.5 -L 1.3 -u app -y -p -3 $ra -4 $dec -5 1.0 $fitfile
else
	solve-field --use-source-extractor --nsigma 5  -O -t 4 -H 1.5 -L 1.3 -u app -y -p $fitfile
fi
 newfitfile=`echo $fitfile | sed 's/fit/new/g'`
 nnewfitfile=`echo $fitfile | sed 's/.fit/_wcs.fit/g'`
 echo $newfitfile
 if test -r $newfitfile
 then
	 echo "have $newfitfile"
	 #rm -rf $fitfile
	 cp $newfitfile $nnewfitfile
 	echo "$fitfile is successful"
else
	echo "$fitfile is failed"
 fi
